<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然金融中心管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">省市联动页面</li>
            </ol>
          </div>
        </div>
        <div class="form-horizontal  h-form-warp">
          <form action="" class="form-horizontal" id="systemProvinceForm" method="post" role="form">
            <div class="form-group">
              <div class="col-sm-6">
                <select id="id_provSelect" name="provSelect" onChange="SystemProvinceMgr.loadCity(this.value);">
                  <option value="">请选择省份</option>
                </select>&nbsp;
                <select id="id_citySelect" name="citySelect" onChange="SystemProvinceMgr.loadArea(this.value);">
                  <option value="">请选择城市</option>
                </select>&nbsp;
                <select id="id_areaSelect" name="areaSelect">
                  <option value="">请选择区域</option>
                </select>&nbsp;
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->
</div>
<#include "/common/jslib.html">
<!-- form页面js -->
<script type="text/javascript">
    $(function () {
        // 页面操作类型：add(添加)-edit(编辑)-view(查看)
        var operation = $("#operation").val();
        SystemProvinceMgr = {
            // 初始化
            init: function () {
                // 查看的时候不显示保存按钮
                if (operation == "view") {
                    Jmts.setFormReadOnly();
                    $("#save").hide();
                }
                Jmts.loadProvince(PROVINCEURL, 'CN', "id_provSelect", "id_citySelect", "id_areaSelect");
            },
            // init end

            // 提交数据
            submitForm: function () {
                Jmts.ajaxSubmit(document.getElementById("systemProvinceForm"), function (result) {
                    var operation = result.operation;
                    if (result.success) {
                        Jmts.succTips(result.msg);
                        if (operation == 'add') {
                            SystemProvinceMgr.returnIndex();
                        } else if (operation == 'edit') {
                            window.location.reload();
                        }
                    } else {
                        Jmts.errorTips(result.msg);
                    }
                });
                return false;
            },
            // submitForm end
            //返回
            returnIndex: function () {
                window.location.href = "/systemProvince/query";
            },
            //加载城市
            loadCity: function (provinceId) {
                Jmts.loadCity(CITYURL, provinceId, "id_provSelect", "id_citySelect", "id_areaSelect");
            },
            //加载区域
            loadArea: function (cityId) {
                Jmts.loadArea(AREAURL, cityId, "id_areaSelect")
            }
        };
        // 执行初始化
        SystemProvinceMgr.init();
        // 前台验证表单
        $("#systemProvinceForm").validate();
    });
</script>
</body>
</html>
